import * as constants from './constants';
import { fromJS } from 'immutable';
import axios from 'axios';

const changHomeData=(result) =>({
  type: constants.CHANGE_HOME_DATA,
  topicList: result.topicList,
  articleList: result.articleList,
  recommendList: result.recommendList
});

export const getHomeTopics=()=>{
  return (dispatch) => {
    axios.get('/api/home.json').then((res) => {
      const result = res.data.data;
      dispatch(changHomeData(result));
    });
  }
};
